/**
 * @author  guocailee
 */
import * as securityServices from 'src/api/security'
import types from '../types.js'

export const updateEmail = (store, email) => {
  return securityServices.updateEmail(email).then(data => {
    store.dispatch(types.security.UPDATE_EMAIL, email)
  })
}

export const updateMobile = (store, mobile) => {
  return securityServices.updateMobile(mobile).then(data => {
    store.dispatch(types.security.UPDATE_MOBILE, mobile)
  })
}

export const updateQeustion = (store, questionList) => {
  return securityServices.updateQeustion(questionList).then(data => {
    store.dispatch(types.security.UPDATE_QUESTION, true)
  })
}

export const getUserSecurityQuestion = (store) => {
  return securityServices.getUserSecurityQuestion().then(data => {
    store.dispatch(types.security.UPDATE_QUESTION, data)
  })
}

export const getQuestionList = (store) => {
  return securityServices.getQuestionList().then(data => {
    store.dispatch(types.security.UPDATE_QUESTION_LIST, data)
  })
}
